global class ReturnProduct {
	global String  objId ;//对象的ID 
	global String company ;//公司
	global String productName ;//品名
	global Id  productId;//id
	global Decimal taxrate ;//税率
	global String nccode;// 存货编码

	global String  spec {get;set;}//规格
	global String  serialNo {get;set;}//货号
	global String  model {get;set;}//型号
	global String  brand {get;set;}//品牌

	global String cate0 {get;set;}//主分类
	global String cate1 {get;set;}//一级分类
	global String cate2 {get;set;}//二级分类
	global String cate3 {get;set;}//三级分类
	global String productType {get;set;}//产品类型
	global String zl  {get;set;}//装量
	global Decimal testNum {get;set;}//测试数
	global Decimal swjhdj {get;set;}///生物计划单价

	global Decimal price {get;set;} //价目表价格
	global Decimal sysPrice {get;set;}//体系价目表价格

	global Decimal companyBottomPrice {get;set;}//公司底价
	global Decimal areaDealerPrice {get;set;}//区域经销商价
	global Decimal instCost {get;set;}//成本价
	global Decimal invoiceDealerPrice {get;set;}//报价经销商价
	global Decimal hospitalManagerPrice {get;set;}//终端指导价
	global Decimal repairCost {get;set;}//保修陈本价
	global Decimal specialprice {get;set;}//保修陈本价



	global Decimal marketPrice {get;set;}//市场报价

	global Decimal lastMothPrice {get;set;}//上月平均价

	global Boolean isHasPrice ;//是否有价格体系
	global Boolean isSeal ; //是否封存

	global Boolean isMatch ;//s是否匹配
	global String  mark ;//描述
	global Boolean isFromsys; //是否来自系统


	global ReturnProduct(Product__c p,Price__c pr ,String code ,String com,PriceList__c  pl ,String sealflag ){
		company = com;
		if(p != null ){
			productName = p.Name;
			productId = p.Id;
			nccode = p.NCCode__c;

			testNum = p.TestNumber__c;
			spec = p.Spec__c;
			serialNo = p.SerialNo__c;
			model = p.Model__c;
			brand = p.Brand__c;

			cate0 = p.Category0__c;
			cate1 = p.Category1__c;
			cate2 = p.Category2__c;
			cate3 = p.Category3__c;
			productType = p.TypeName__c;
			swjhdj = p.swjhdj__c;

			zl = p.zl__c;
			isFromsys = false;
			
			isSeal = (p.SealCompany__c != null && p.SealCompany__c.contains(sealflag));
			if(pl != null)price = pl.Price__c;
			if(pr != null){
				isHasPrice = true;
				marketPrice = pr.MarketPrice__c;
				taxrate = pr.Taxrate__c;

				companyBottomPrice = pr.CompanyBottomPrice__c;
				areaDealerPrice = pr.AreaDealerPrice__c;
				instCost = pr.InstCost__c;
				invoiceDealerPrice = pr.InvoiceDealerPrice__c;
				hospitalManagerPrice = pr.HospitalManagerPrice__c;
				repairCost = pr.RepairCost__c;
                specialprice = pr.SpecialPrice__c;
			}else{
				isHasPrice = false;
				mark = p.Name +'在'+com +'没有匹配到相应的价格体系!';
			}
			if(isSeal == true)mark = '存货编码为:' +code +'的'+p.Name +'在'+com+'已经被封存!'; 
			isMatch = true;
		}else{
			isMatch = false;
			mark = '没有找到存货编码为:'+code +'的产品!';

		}
	}

	global ReturnProduct(Product__c p,Price__c pr ,AveragePrice__c ap,PriceList__c  pl ,PriceList__c syspl,String code ,String com,String sealflag ){
		company = com;
		if(p != null ){
			productName = p.Name;
			productId = p.Id;
			nccode = p.NCCode__c;

			spec = p.Spec__c;
			serialNo = p.SerialNo__c;
			model = p.Model__c;
			brand = p.Brand__c;

			cate0 = p.Category0__c;
			cate1 = p.Category1__c;
			cate2 = p.Category2__c;
			cate3 = p.Category3__c;
			productType = p.TypeName__c;
			swjhdj = p.swjhdj__c;
			testNum = p.TestNumber__c;

			zl = p.zl__c;
			if(pl != null)price = pl.Price__c;
			if(syspl != null){
				sysPrice = syspl.Price__c;
				isFromsys = sysPrice != null;
			}else{
				isFromsys = false;
			}


			isSeal = (p.SealCompany__c != null && p.SealCompany__c.contains(sealflag));
			if(ap != null ){
				lastMothPrice = ap.AveragePrice__c;
			}
			if(pr != null){
				isHasPrice = true;
				marketPrice = pr.MarketPrice__c;
				taxrate = pr.Taxrate__c;

				companyBottomPrice = pr.CompanyBottomPrice__c;
				areaDealerPrice = pr.AreaDealerPrice__c;
				instCost = pr.InstCost__c;
				invoiceDealerPrice = pr.InvoiceDealerPrice__c;
				hospitalManagerPrice = pr.HospitalManagerPrice__c;
				repairCost = pr.RepairCost__c;
                specialprice = pr.SpecialPrice__c;

			}else{
				isHasPrice = false;
				mark = p.Name +'在'+com +'没有匹配到相应的价格体系!';
			}
			if(isSeal == true)mark = '存货编码为:' +code +'的'+p.Name +'在'+com+'已经被封存!'; 
			isMatch = true;
		}else{
			isMatch = false;
			mark = '没有找到存货编码为:'+code +'的产品!';

		}
	}
}